/**
 * @Author：ming
 * @Date：2023/10/29 3:36 PM
 * @Filename：Hot206
 */


import java.util.ArrayList;

/**
 * @author ming
 */
public class Hot206 {
    public ListNode reverseList(ListNode head) {
        if(head==null){
            return null;
        }
        ListNode pre = null;
        ListNode cur = head;
        while (cur!=null){
            ListNode q = cur.next;
            cur.next = pre;
            pre = cur;
            cur = q;
        }
        return pre;
    }
}
